{% extends "layouts" ~ DIR ~ "default.twig" %}

{% block title %}{{ "Edit Comment" | translate("comments") }}{% endblock %}

{% block content %}
<h2>{{ "Editing Comment on &#8220;%s&#8221;" | translate("comments") | format(comment.post.title() | striptags | oneof("[Untitled]" | translate)) }}</h2>
<form id="edit_form" action="{{ url('update_comment') }}" method="post" accept-charset="UTF-8">
<fieldset role="presentation">
{% set field_preview = ' data-preview="user_id:' ~ (comment.user_id | fix(true)) ~ '"' %}
{% set comment_markdown = site.enable_markdown ? " data-markdown" : "" %}
<p class="main_options">
<label for="body">
{{ "Body" | translate("comments") }}
</label>
<span id="body_toolbar" class="options_toolbar text_block_toolbar">
{% if site.enable_markdown %}
<a href="{{ url('help/id/markdown') }}" target="_blank" class="help emblem markdown">
{{- icon_svg("markdown.svg", "Markdown" | translate) -}}
</a>
{% endif %}
</span>
<textarea rows="10" name="body" id="body"{{ field_preview ~ comment_markdown }} required>{{ comment.body | fix(false, true) }}</textarea>
<span id="body_tray" class="options_tray" role="status"></span>
</p>
<div id="more_options" class="more_options">
<p class="more_options_option">
<label for="author">{{ "Author" | translate("comments") }}</label>
<input class="text" type="text" name="author" value="{{ comment.author | fix(true, true) }}" id="author" maxlength="250" required>
</p>
{% if comment.status != "pingback" %}
<p class="more_options_option">
<label for="author_email">{{ "Author Email" | translate("comments") }}</label>
<input class="text" type="email" name="author_email" value="{{ comment.author_email | fix(true, true) }}" id="author_email" maxlength="128" required>
</p>
<p class="more_options_option">
<label for="author_url">{{ "Author Website" | translate("comments") }}</label>
<input class="text" type="url" name="author_url" value="{{ comment.author_url | fix(true, true) }}" id="author_url" maxlength="2048">
</p>
{% endif %}
{% if visitor.group.can("edit_comment") %}
{# User can edit all comments, not just their own. #}
<p class="more_options_option">
<label for="created_at">{{ "Timestamp" | translate("comments") }}</label>
<input class="text" type="text" name="created_at" value="{{ comment.created_at | dateformat('Y-m-d H:i:s') | fix(true, true) }}" id="created_at">
</p>
{% if comment.status != "pingback" %}
<p class="more_options_option">
<label for="status">{{ "Status" | translate("comments") }}</label>
<select name="status" id="status">
{% set comment_status = comment.status | selected("approved") %}
<option value="approved"{{ comment_status }}>{{ "Approved" | translate("comments") }}</option>
{% set comment_status = comment.status | selected("denied") %}
<option value="denied"{{ comment_status }}>{{ "Denied" | translate("comments") }}</option>
{% set comment_status = comment.status | selected("spam") %}
<option value="spam"{{ comment_status }}>{{ "Spam" | translate("comments") }}</option>
</select>
</p>
{% endif %}
{% endif %}
{% if comment.status != "pingback" and site.email_correspondence %}
<p class="more_options_option">
<label for="notify">{{ "Email Notifications" | translate("comments") }}</label>
<input type="checkbox" name="notify" id="notify"{{ comment.notify | checked }}>
</p>
{% endif %}
{{ trigger.call("edit_comment_options", comment) }}
</div>
<input type="hidden" name="hash" value="{{ authenticate() }}" id="hash">
<input type="hidden" name="id" value="{{ comment.id }}" id="id">
<div class="buttons confirmation">
<button type="submit">
{{ "Save" | translate("comments") }}
</button>
{{ comment.delete_link("Delete" | translate("comments"), null, null, "button boo") }}
</div>
</fieldset>
</form>
{% endblock %}
